cmake_minimum_required(VERSION 3.0)

include_directories(utils)
include_directories(net/connect)
include_directories(net/http)
include_directories(net)

set(UTIL_FILES
        utils/cm_common.h
        utils/cm_list.c
        utils/cm_list.h
        utils/cm_logprint.h
        utils/cm_print.c
        utils/cm_print.h
        utils/cm_print_cc.c
        utils/cm_print_cc.h
        utils/cm_time.c
        utils/cm_time.h
        utils/cm_utils.c
        utils/cm_utils.h
        utils/jkbytes.c
        utils/jkbytes.h
        utils/re_list.c
        utils/re_list.h
        utils/rt_print.c
        utils/rt_print.h
        utils/XN_Queue.h
        )

set(AUTOTEST_FILES
        autotest/CMAutoTestCommand.cpp
        autotest/CMAutoTestCommand.h
        autotest/CMCommandInstance.cpp
        autotest/CMCommandInstance.h
        autotest/CMFifoHandler.cpp
        autotest/CMFifoHandler.h
        autotest/CMTestKeyCommand.cpp
        autotest/CMTestKeyCommand.h
        )

set(CONFIG_FILES
        config/cm_conf_ex.cpp
        config/cm_conf_ex.h
        config/cm_conf.c
        config/cm_conf.h
        )

set(CRYPTO_FILES
        crypto/aeslib.c
        crypto/aeslib.h
        crypto/cm_base64.c
        crypto/cm_base64.h
        crypto/ngx_md5.c
        crypto/ngx_md5.h
        crypto/polaraes.c
        crypto/polaraes.h
        )

set(I18N_FILES
        i18n/CMLanguageConfig.cpp
        i18n/CMLanguageConfig.h
        )

set(MISC_FILES
        misc/led/cm_led_normal.c
        misc/led/cm_led.h
        misc/cm_debug_out.c
        misc/cm_debug_out.h
        misc/cm_fifo.c
        misc/cm_fifo.h
        misc/cm_flash_cfg.c
        misc/cm_flash_cfg.h
        misc/cm_local_debug.c
        misc/cm_local_debug.h
        misc/cm_suspend.c
        misc/cm_suspend.h
        misc/cm_sys.c
        misc/cm_sys.h
        misc/cm_uart.c
        misc/cm_uart.h
        misc/cm_uart_ex.cpp
        misc/cm_uart_ex.h
        misc/cm_wifi.c
        misc/cm_wifi.h
        )

set(LED_FILES
        misc/led/cm_led_normal.c
        misc/led/cm_led_ctrl.c
        misc/led/cm_led_ctrl.h
        misc/led/cm_led.h
        )

set(ALL_FILES
        ${UTIL_FILES}
        ${MISC_FILES}
        ${I18N_FILES}
        ${CRYPTO_FILES}
        ${CONFIG_FILES}
        ${AUTOTEST_FILES}
        ${LED_FILES}
        )

add_library(common
        ${ALL_FILES}
        )

add_subdirectory(funcs)
add_subdirectory(net)
add_subdirectory(msg)
if (WITH_DBUSCPP)
    add_subdirectory(dbuscpp)
endif()

add_executable(led_test
        misc/led/cm_led_test.c
        ${ALL_FILES}
        )

target_link_libraries(led_test
        net pthread
        )
